<!DOCTYPE html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <title>晚点名</title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/assets/public/layermobile/css/layer.css">
    <link rel="stylesheet" href="/assets/doorctrl/css/style.css"/>
    <link rel="stylesheet" href="/assets/doorctrl/css/fonts.css"/>
    <link rel="stylesheet" href="/assets/public/layermobile/css/layer.css"/>
</head>
<body>
<div class="relative">
    <div class="wraper">
        <div class="header font-16 flex padding-12">
            <div class="iconfont icon-zuo font-24"></div>
            <span>晚点名</span>
            <div class="font-14 js_screen">筛选</div>
            <input type="hidden" value="{BEESCRM:$doorctrlId}" id="js_doorctrlId"/>
        </div>
        <div class="font-gray padding2-16 heightjs">
            今日未归人员 <span><?php echo date('Y-m-d');?></span>&nbsp;&nbsp;<span>重点未归:{BEESCRM:$list[0]['important_num']}人</span>
            <input type="hidden" name="maxId" id="currentMaxId" value="{BEESCRM:$maxId}" />
        </div>
        <div id="lateDataList">
            <volist name="list" id="vo">
                <div class="box Student title  margin-10">
                    <a href="/Doorctrl/DoorctrlEnter/detail/doorctrlId/{BEESCRM:$doorctrlId}/statics_id/{BEESCRM:$vo['statics_id']}" style="color: #2a2a2a;">
                        <div class="flex">
                            <div>
                                <p><if condition="$vo['user_info']['is_important'] eq 1">(重点)</if>{BEESCRM:$vo['user_info']['real_name']} {BEESCRM:$vo['dorm_info']['community_name']}{BEESCRM:$vo['dorm_info']['building_name']}{BEESCRM:$vo['dorm_info']['room']}</p>
                            </div>
                            <div class="iconfont icon-you font-gray"></div>
                            <if condition="$vo['user_info']['is_important'] eq 1">
                                <div class="sign"></div>
                            </if>
                        </div>
                    </a>
                    <div class="prove font-12 clearfix">
                        <if condition="$vo['is_enter'] eq 1">
                            <span class="font-gray">最近核查 {BEESCRM:$vo['enter_time']}</span>
                            <span class="pull-right">
                                <span class="then">已核未归</span>
                            </span>
                        <else/>
                            <span class="pull-right">
                                <span class="then js_no_back" data-value="2" data-id="{BEESCRM:$vo['statics_id']}">未归</span>
                                <span class="been js_back" data-value="1" data-id="{BEESCRM:$vo['statics_id']}">已归</span>
                            </span>
                        </if>
                    </div>
                </div>
            </volist>
        </div>
        <div class="js_no_more hide">
            <div style="padding: 20px"></div>
            <p class="font-12 font-gray NO-post">没有更多记录了</p>
        </div>

        <if condition="empty($list)">
            <div class="NO-post">
                <div class="font-gray no-data"><p>暂无数据</p></div>

            </div>
        </if>

        <div class="pop-box hide" id="js_back_box">
            <div class="pop-hint">
                <div class="iconfont icon-guanbi Close font-18"></div>
                <p class="font-16 text-center">是否已归寝？</p>
                <div class="font-14 text-center">
                    <a class="btn pop-btn btn-left" href="javascript:;">取消</a>
                    <a  class="btn pop-btn js_back_submit" href="javascript:;" data-type="" data-id="">确定</a>
                </div>
            </div>
        </div>
        <div class="pop-box1 hide" id="js_no_back_box">
            <div class="pop-hint">
                <div class="iconfont icon-guanbi Close font-18"></div>
                <p class="font-16 text-center">是否核实未归？</p>
                <div class="font-14 text-center">
                    <a class="btn pop-btn btn-left" href="javascript:;">取消</a>
                    <a  class="btn pop-btn js_no_back_submit" href="javascript:;" data-type="" data-id="">确定</a>
                </div>
            </div>
        </div>

        <!--没有权限和非正常点名时间情况-->
        <if condition="$noRange eq 1 or $noConfirmTime eq 1">
            <div class="pop-box1">
                <div class="pop-hint">
                    <div class="iconfont icon-guanbi Close font-18"></div>
                    <p class="font-16 text-center">
                        <if condition="$noRange eq 1">
                            您不是晚点名管理员，无法查看学生信息
                        </if>
                        <if condition="$noConfirmTime eq 1 and $noRange neq 1">
                            现在不是晚点名时间
                        </if>
                    </p>
                    <div class="font-14 text-center">
                        <a  class="btn pop-btn js_close" href="javascript:;">确定</a>
                    </div>
                </div>
            </div>
        </if>

    </div>
    <div class="wraper2 absolute hide">
        <div class="header font-16">
            <div class="iconfont icon-zuo back font-24"></div>
            <span>筛选</span>
        </div>
        <div class="Chose margin-10">
            <div class=" chose">
                <select name="" id="community">
                    <option value="0">请选择园区</option>
                    <volist name="communityList" id="vo">
                        <option value="{BEESCRM:$vo['community_id']}">{BEESCRM:$vo['community_name']}</option>
                    </volist>
                </select>
                <div class=" iconfont icon-xiaosanjiao"></div>
            </div>
            <div class=" chose border-top">
                <select name="" id="building">
                    <option value="0">请选择楼幢</option>
                </select>
                <div class=" iconfont icon-xiaosanjiao"></div>
            </div>
            <div class=" chose border-top">
                <select name="" id="room">
                    <option value="0">请选择寝室</option>
                </select>
                <div class=" iconfont icon-xiaosanjiao"></div>
            </div>
        </div>
        <a class="btn btn-2" href="javascript:;" id="js_search">筛选</a>
    </div>
</div>
<include file="../load" />
<script src="/assets/public/jquery-2.1.0.min.js"></script>
<script src="/assets/doorctrl/js/public.js"></script>
<script src="/assets/public/layermobile/layer.js"></script>
<script src="/assets/doorctrl/js/apartment.js"></script>
<script src="/assets/doorctrl/js/doorctrlEnter/index.js"></script>
<script>
    $(function () {
        var height = $(window).height();
        $('.wraper,.wraper2').css('minHeight', height);
        var height1=$(".header").innerHeight();
        var height2=$(".heightjs").innerHeight();
        $(".no-data").css("height",height-height1-height2);
        var maxId = $("#currentMaxId").val();

        //点击搜索园区、楼幢等联动
        ApartmentObj.init($('#community'),$('#building'),$('#room'));
        $('#community').on('change',function () {
            ApartmentObj.communityChange();
        });
        $('#building').on('change',function () {
            ApartmentObj.buildingChange();
        });
        $('#room').on('change',function () {
            ApartmentObj.roomChange();
        });

        $(".js_screen").click(function(){
            $(this).parent().parent().next('.wraper2').removeClass("hide");
            $(this).parent().parent('.wraper').addClass("hide");
        });
        $(".back").click(function(){
            $(this).parent().parent().siblings().removeClass("hide");
            $(this).parent().parent('.wraper2').addClass("hide");
        });


        //点击搜索
        $(document).on('click','#js_search',function () {
            var community_id = $("#community").val();
            var building_id = $('#building').val();
            var room_id = $('#room').val();

            var url = '/Doorctrl/DoorctrlEnter/index/doorctrlId/{BEESCRM:$doorctrlId}/community_id/'+community_id+'/building_id/'+building_id+'/room_id/'+room_id;
            location.href = url;
        });

        //滚动条加载
        $(window).scroll(function () {
            if ($(document).scrollTop()+$(window).height() >= $(document).height()) {
                ajaxGetData();
            }
        });


        function ajaxGetData()
        {
            var _html = '';
            $.ajax({
                url : "/Doorctrl/DoorctrlEnter/ajaxGetLateData/doorctrlId/{BEESCRM:$doorctrlId}",
                type : "POST",
                data : {'maxId' : maxId},
                dataType : "JSON",
                beforeSend : function(){
                    $('.load').show();
                },
                success : function(res) {
                    $('.load').hide();
                    if(res.status == 'S'){
                        //设置最大id
                        maxId = res.data.maxId;
                        if(res.data.list.length > 0){
                            for(var i=0;i<res.data.list.length;i++){
                                var importantSign = '';
                                var importantName = '';
                                var enterLog = '';
                                if(res.data.list[i].user_info.is_important == 1){
                                    importantSign = '<div class="sign"></div>';
                                    importantName = '(重点)';
                                }
                                if(res.data.list[i].is_enter == 1){
                                    enterLog =  '<span class="font-gray">最近核查 res.data.list[i].enter_time</span>' +
                                                '<span class="pull-right">' +
                                                '<span class="then">已核未归</span>' +
                                                '</span>';
                                }else{
                                    enterLog =  '<span class="pull-right">' +
                                                '<span class="then js_no_back" data-value="2" data-id="'+ res.data.list[i].statics_id+'">未归</span>' +
                                                '<span class="been js_back" data-value="1" data-id="'+ res.data.list[i].statics_id +'">已归</span>' +
                                                '</span>'
                                }

                                _html += '<div class="box Student title  margin-10">' +
                                        '<a href="/Doorctrl/DoorctrlEnter/detail/doorctrlId/{BEESCRM:$doorctrlId}/statics_id/{BEESCRM:$vo.statics_id}" style="color: #2a2a2a;">' +
                                        '<div class="flex">' +
                                        '<div>'+
                                        '<p>'+importantName+'&nbsp;'+res.data.list[i].user_info.real_name+'&nbsp;'+res.data.list[i].dorm_info.community_name+res.data.list[i].dorm_info.building_name+res.data.list[i].dorm_info.room+'</p>'+
                                        '</div>' +
                                        '<div class="iconfont icon-you font-gray"></div>' + importantSign +
                                        '</div></a>' +
                                        '<div class="prove font-12 clearfix">' + enterLog +
                                        '</div></div>';
                            }
                        }
                        if(_html != ''){
                            $(".js_no_more").addClass('hide');
                            $("#lateDataList").append(_html);
                        }else{
                            $(".js_no_more").removeClass('hide');
                        }
                    }else{
                        fm.alert('请求数据失败');
                    }
                },
                error : function(){
                    fm.alert('网络错误,请重试');
                }


            });
        }
    });


</script>
</body>
</html>